{extend name='admin@public/content'}

{block name="button"}
{if auth("$classuri/content")}
<button data-open='{:url("$classuri/content")}?pid={$Think.get.id}' class='layui-btn layui-btn-sm'>添加</button>
{/if}
{if auth("$classuri/forbid")}
<button data-update data-field='status' data-value='2' data-action='{:url("$classuri/forbid")}' class='layui-btn layui-btn-sm layui-btn-warm'>禁用</button>
{/if}
{if auth("$classuri/resume")}
<button data-update data-field='status' data-value='1' data-action='{:url("$classuri/resume")}' class='layui-btn layui-btn-sm layui-btn-normal'>启用</button>
{/if}
{if auth("$classuri/del")}
<button data-update data-field='is_deleted' data-value="2" data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-sm layui-btn-danger'>删除</button>
{/if}
{/block}

{block name="content"}
<script>
    window.laydate.render({range: true, elem: '#range-date'});
</script>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    {empty name='list'}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none="" data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <!--<button type="submit" class="layui-btn layui-btn-normal layui-btn-xs">排 序</button>-->
            </th>
            <th class='text-left nowrap'>标题</th>
            <th class='text-left nowrap'>添加时间</th>
            <th class='text-left nowrap'>是否可用</th>
            <th class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td think-checkbox'>
                    <input class="list-check-box" value='{$vo.id}' type='checkbox'>
                </td>
                <td class='list-table-sort-td'>
                    <input name="_{$vo.id}" value="{$vo.sort}" autocomplete="off" class="list-sort-input">
                </td>
                <td class='text-left nowrap'>
                    {$vo.title}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_at|format_datetime|str_replace=' ','<br>',###|raw}
                </td>
                <td class='text-left nowrap'>
                    {if $vo.status == 1}
                    <font color="green">正常使用</font>
                    {else}
                    <font color="red">已禁用</font>
                    {/if}
                </td>
                <td class='text-left nowrap'>
                    <!-- Single button -->
                    <div class="btn-group">
                        {if auth("$classuri/content") && $vo.type=='content'}
                        <button type="button" class="btn btn-success" data-open='{:url("$classuri/content")}?id={$vo.id}'>编辑</button>
                        {elseif auth("$classuri/lists") && $vo.type=='lists'}
                        <button type="button" class="btn btn-success" data-open='{:url("$classuri/lists")}?id={$vo.id}'>编辑</button>
                        {/if}
                        <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
                            {if auth("$classuri/forbid") && $vo.status==1}
                            <li><a data-update="{$vo.id}" data-field="status" data-value="2" data-action='{:url("$classuri/forbid")}'>禁用</a></li>
                            {/if}
                            {if auth("$classuri/resume") && $vo.status==2}
                            <li><a data-update="{$vo.id}" data-field="status" data-value="1" data-action='{:url("$classuri/resume")}'>启用</a></li>
                            {/if}
                            {if auth("$classuri/del")}
                            <li><a data-update="{$vo.id}" data-field='is_deleted' data-value="2" data-action='{:url("$classuri/del")}'>删除</a></li>
                            {/if}
                        </ul>
                    </div>
                </td>
            </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    {/empty}
</form>
{/block}